<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Book extends CI_Controller {
    private $data = array();

    public function  __construct() {
        parent::__construct();

        //check session
        if( !$this->session->userdata('isLoggedIn') ) {
            redirect(base_url().'admin', 'refresh');
        }

        //Load Helper and library
        $this->load->helper("url");
        $this->load->library("ci_smarty");
        $this->load->helper("text"); 
        $this->data['base_url'] = base_url();
        $this->data['root_url'] = $this->config->item('root_url');
        $this->load->library('pagination'); 

        //Load Model
        $this->load->Model("admin/Mcategory");
        $this->load->Model("admin/Mbook");

        $this->data['nameAdmin'] = $this->session->userdata('name');
    }

    public function listAllBook()
    {
        $this->data['listBookAll'] = $this->Mbook->getAllBook();
        $this->ci_smarty->view('backend/index.tpl',$this->data); 
    }
}